package cn.org.dian.easycommunicate.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

public class Term {
    
    private static List<String> allLanguageNames = new ArrayList<String>();
    
    private String name = null;
    /**
     * <languageName, Content>
     */
    private HashMap<String, String> allLanguages = null;
    
    public Term() {
        this.allLanguages = new LinkedHashMap<String, String>();
    }
    
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    public void addLanguage(String languageName, String content) {
        this.allLanguages.put(languageName, content);
    }
    
    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("---Term: " + name + "\n");
        for (String languageName : allLanguages.keySet()) {
            sb.append("language: " + languageName + "content: " + allLanguages.get(languageName) + "\n");
        }
        sb.append("---Term end\n");
        return new String(sb);
    }

    /**
     * @return the allLanguages
     */
    public HashMap<String, String> getAllLanguages() {
        return allLanguages;
    }

    /**
     * @return the allLanguageNames
     */
    public static List<String> getAllLanguageNames() {
        return allLanguageNames;
    }

    /**
     * @param allLanguageNames the allLanguageNames to set
     */
//    public static void setAllLanguageNames(List<String> allLanguageNames) {
//        Term.allLanguageNames = allLanguageNames;
//    }
    
    public static void addAllLanguageNames(String languageName) {
        Term.allLanguageNames.add(languageName);
    }
}